package com.haibei.activity.common;

import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.TextView;

import com.common.uitl.StringUtils;
import com.haibei.R;
import com.haibei.activity.BaseHaibeiActivity;

public class InfoDetailActivity extends BaseHaibeiActivity {

	private TextView textViewContent;
	private WebView webViewContent;
	private String content = "";

	protected void onCreate(android.os.Bundle savedInstanceState) {
		initView();
		try {
			content = getIntent().getStringExtra("content");
		} catch (Exception e) {
			e.printStackTrace();
		}
	};

	@Override
	public void initView() {
		setContentView(R.layout.activity_info_detail);
		textViewContent = findTextViewById(R.id.textViewContent);
		textViewContent.setVisibility(View.INVISIBLE);
		webViewContent = (WebView) findViewById(R.id.webViewContent);
		webViewContent.setVisibility(View.INVISIBLE);
		if (!StringUtils.isEmpty(content)) {
			if ("http".startsWith(content)) {
				webViewContent.setVisibility(View.VISIBLE);
			} else {
				textViewContent.setVisibility(View.VISIBLE);
				textViewContent.setText(content);
			}
		}

		findViewById(R.id.buttonBack).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}
}
